package com.jason.exp.entity;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;

/**
 * Created by fuyongde on 2016/8/31.
 */
public class User extends BaseEntity implements Serializable {

    public final static String HEAD_DEFAULT = "http://7xpy06.com1.z0.glb.clouddn.com/header_default.png";

    private String id;
    /**用户名**/
    @NotBlank(message = "用户名不能为空")
    @Length(min = 6, max = 32, message = "用户名长度在6~32个字符之间")
    private String username;
    /**姓名**/
    private String name;
    /**头像**/
    private String head;
    /**性别**/
    private Integer sex;
    /**电话**/
    private String phone;
    /**邮箱**/
    private String email;
    /**身份证号**/
    private String idCard;
    /**用户状态**/
    private Integer status;
    /**邀请人**/
    private String inviter;
    /**来源**/
    private Integer source;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHead() {
        return head;
    }

    public void setHead(String head) {
        this.head = head;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getInviter() {
        return inviter;
    }

    public void setInviter(String inviter) {
        this.inviter = inviter;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public enum Sex {
        wowan(0, "女"),
        man(1, "男"),
        unknown(2,"未知");

        int value;
        String name;

        Sex(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public enum Status {
        init(0, "未激活"),
        activate(1, "已激活"),
        forbidden(-1, "禁用");
        int value;
        String name;

        Status(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public enum Source {
        system(-1, "系统"),
        unknown(0, "未知"),
        app(1, "App"),
        web(2, "Web"),
        h5(3, "H5"),
        wechat(4, "微信"),
        weibo(5, "微博"),
        qq(6, "QQ"),
        xiaomi(7, "小米");

        int value;
        String name;

        Source(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }
}
